package com.wdc.n1;

import lombok.extern.slf4j.Slf4j;

import javax.swing.plaf.nimbus.State;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

@Slf4j(topic = "c.test2")
public class Test2 {
    public static void main(String[] args) throws InterruptedException {

        //任务是任务，线程是线程。把任务和线程分离了，更灵活
        Runnable runnable = () -> {log.info(" 创建 Runnable");};

        //创建线程
        Thread thread = new Thread(runnable, "t2");
        thread.start();
        log.info("我是主线程 里面的wdc");

        Thread.sleep(2);
        TimeUnit.DAYS.sleep(1);

        System.out.println(Runtime.getRuntime().availableProcessors());
    }

    class Ticket implements Runnable {

        private   int number = 50;


        public void sale() {
            number -=  1;
        }

        @Override
        public void run() {

        }
    }

    class T {
        private   int number = 50;


        public void sale() {
            number -=  1;
        }

    }
}
